/*
 *  Copyright 2010 Mahbub Mozadded Sowrov.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
package com.sowrov.afrigis.tools.timesheet;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;

/**
 * Write about the class here
 *
 * @author Mahbub Mozadded (Sowrov)
 * @date Apr 19, 2010
 */
public class ConfigDataFile {

    private String fileName = "config.dat";

    private String filePath;

    private File file;

    private FileReader reader;

    private FileWriter writer;

    public ConfigDataFile() {
        filePath = System.getProperty("user.home") + "/timesheet/";
        new File(filePath).mkdirs();
        file = new File(filePath + fileName);

        reader = null;
        writer = null;
    }

    public boolean exists() {
        if (file.exists() && file.canRead() && file.canWrite()) {
            return true;
        }
        else {
            try {
                return file.createNewFile();
            }
            catch (IOException ex) {
                return false;
            }
        }
    }

    public static void main(String[] arg) {
        try {
            //FileWriter fw = new FileWriter("test.txt");
            RandomAccessFile rf = new RandomAccessFile("test.txt", "rw");
            //rf.
        }
        catch (IOException ex) {
            Logger.getLogger(ConfigDataFile.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
